putty is an SSH and telnet client for windows users to connect to Linux systems.
When connected to Ubuntu Virtual machine, I use putty as a Linux terminal and I use vim as my editor to do some coding. Vim can be configured into a beautiful IDE but putty cannot show the beauty because putty is not a GUI mode.
putty vim 256 color problem
When I try to config vim with some interface, such as solarized, vim-airline or some general config to hilight the cursor line and cursor column in .vimrc
:
The effect is terrible and the variable can only support 8 colors. Some people may run into the problem such as someone in stackoverflow.
Yes right there must be some ways to solve the problem!!
putty
In the putty config, Window->colours
, enable the xterm 256-colour mode
.
Also I set some colors here:
Default Forground: RGB(143,119,181)
Default Bold Forground: RGB(255,255,255)
Default Background: RBG(0,0,0)
Default Bold Background RGB(85,85,85)
Cursor Colour: RGB(240,94,28)
There is a japan traditional color website shows a varity of colors.
In Window->Appearance
, set:
Font: Consolas
size: 14-point
Moreover, the configuration of putty must be save under a session. And the configuation is only effective the the single session. So I recommend you the tool putty manager, which can manage putty and winscp.
bash
In the ubuntu virtual machine, we need to change the ~/.bashrc
, the terminal support 256-mode, so adding the script:
Rember to reopen a putty, or the .bashrc won’t be reload.
vim
add the script to .vimrc
Then it’s free to use the colorful plugins.
setting for solarized:
setting for cursor:
Only cterm matters because we are not in gui mode. And the color can be quired in Xterm256 color table.
Final effect of putty with vim
putty airline seperator font problem
Some people may find that in the effect, the seperator looks strange. The seperator should be ‘▶’. ‘>’ or ‘>>’ may look not that good. Also some people want to solve the symbol font problem.
As recommanded in the answer, we need to install the corresponding font in terminal, here means putty. While putty support the font installed in the windows system.
Here is the steps(prequest: have already solved the previous problem, xterm 256 color supported and vim-airline installed.):
- download the powerline fonts, install them in windows, so that putty can support these fonts. You can also installed them in Ubuntu virtual machine in case of gui mode.
- reopen putty
Window-Apperance-Font
set to a font downloaded, such as Hack.Window-Translation-Character Set
set to UTF-8.
- Verify your .vimrc and ubuntu VM support UTF-8.
Change the
.vimrc
file. The setting of seperator can be viewed with command in vim:1:help airlineadd the following to
.vimrc
:12345678910111213141516171819202122""""""""""""""""""""""" Conf for airline """""""""""""""""""""""let g:airline_powerline_fonts = 1if !exists('g:airline_symbols')let g:airline_symbols = {}endif" powerline symbolslet g:airline_left_sep = ''let g:airline_left_alt_sep = ''let g:airline_right_sep = ''let g:airline_right_alt_sep = ''let g:airline_symbols.branch = ''let g:airline_symbols.readonly = ''let g:airline_symbols.linenr = ''let g:airline#extensions#tabline#enabled = 1let g:airline#extensions#tabline#left_sep = ''let g:airline#extensions#tabline#left_alt_sep = ''let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
The is some the root of the problem. They look like this in the setting:
final effect of powerline
Wow! That’s it! Much much much beautiful! Go coding!
The setting of vim can be downloaded from my github, dotfile repository. Or run the command